package scau.erps.view.business;

import java.awt.BorderLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import scau.erps.app.Erps;
import scau.erps.entity.Staff;
import scau.erps.view.business.staff.EquipmentPanel;
import scau.erps.view.business.staff.LoanPanel;
import scau.erps.view.business.staff.MaterialPanel;
import scau.erps.view.business.staff.OrderPanel;

/**
 * 小组与工作人员办理业务主窗口
 *  
 * @author DCJ
 *
 */
public class BusinessFrame extends JFrame{
	private static final long serialVersionUID = 1L;
	public BusinessFrame(){
		this.setTitle("ERP沙盘教学辅助系统 "+Erps.version);
		this.setSize(1024, 700);
		this.setResizable(false);
		this.setLocationRelativeTo(null);
		this.setDefaultCloseOperation(HIDE_ON_CLOSE);
		JPanel contentPanel = new JPanel();
		JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
		LoanPanel loanPanel = new LoanPanel();
		OrderPanel orderPanel = new OrderPanel();
		MaterialPanel materialPanel = new MaterialPanel();
		EquipmentPanel equipmentPanel = new EquipmentPanel();
		Staff staff = Erps.getCurrentStaff();
		if("银行".equals(staff.getStaffName()) || "教师".equals(staff.getStaffName())){
			tabbedPane.add(loanPanel,"银行");
		}
		if("客户".equals(staff.getStaffName())|| "教师".equals(staff.getStaffName())){
		    tabbedPane.add(orderPanel,"客户");
		}
		if("供应商".equals(staff.getStaffName())|| "教师".equals(staff.getStaffName())){
			tabbedPane.add(materialPanel,"供应商");
		}
		if("设备商".equals(staff.getStaffName())|| "教师".equals(staff.getStaffName())){
			tabbedPane.add(equipmentPanel,"设备商");	
		}
		contentPanel.add(tabbedPane, BorderLayout.CENTER);
		this.setContentPane(contentPanel);
		this.setVisible(true);
	}
}
